// geren/gerenCom/updateImage/updateImage.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    key:{
      type:String,
      value:'证件照'
    },
    xingStyle: {
      type: String
    },
    xing: {
      type: String,
      value: '*'
    },
    imgCount:{
      type:Number,
      value:1
    },
    isShow:{
      type:Number,
      value:0
    },
    content:{
      type:String,
      value:'上传您的身份证正面或相关证件照'
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    imgDis:true,
    imgsrc:'http://icon.tongchengyouzhi.com/ask/add.png',


  },

  /**
   * 组件的方法列表
   */
  methods: {
    
    choose:function(event){ 
      var that=this
     
      console.log(this.properties.isShow)
      var s = this.properties.isShow
      var content = this.properties.content
      console.log(content)
      
      if(s==1){
        wx.showModal({
          title: '',
          content:content,
          success:function(res){
            if(res.confirm){
              wx.chooseImage({
                count: that.properties.imgCount,
                sizeType: 'original',
                sourceType: 'album',
                success: function (res) {
                  console.log(res)
                  that.setData({
                    imgDis: !that.data.imgDis,
                    imgsrc: res.tempFilePaths
                  })
                  that.triggerEvent('chooseImg', { path: res })
                }
              })
            }
          }
        })
      }else {
        wx.chooseImage({
          count: that.properties.imgCount,
          sizeType: 'original',
          sourceType: 'album',
          success: function (res) {
            console.log(res)
            that.setData({
              imgDis: !that.data.imgDis,
              imgsrc: res.tempFilePaths
            })
            that.triggerEvent('chooseImg', { path: res })
          }
        })
      }
     
    }
  }
})
